from google.appengine.ext import db

class Tag(db.Model):
    name = db.StringProperty(required=True)
    
    @staticmethod
    def get_key(name):
        tag = Tag.gql("WHERE name=:1", name).get()
        if tag:
            return tag.key()
        tag = Tag(name=name)
        return tag.put()
    
    def __unicode__(self):
        return self.name


